FROM python:3.11

WORKDIR /usr/src/app
ENV TZ=Asia/Shanghai
COPY requirements-deploy.txt requirements.txt

RUN pip install --no-cache-dir --index-url https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r requirements.txt \
    && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
    && adduser -q --uid 1000 --shell /usr/sbin/nologin --no-create-home --disabled-password --gecos "" app \
    && chown -R app:app .

USER app
COPY --chown=app:app . .

EXPOSE 8787

ENTRYPOINT ["python", "server.py"]
